<%@ page import="com.carmanagement.Maintenance" %>

<script type="text/javascript">
	$(document).ready(function()
	{
	  $("#datepicker").datepicker({dateFormat: 'yy/mm/dd'});
	  $("#datepicker2").datepicker({dateFormat: 'yy/mm/dd'});
	})
</script>

<div class="fieldcontain ${hasErrors(bean: maintenanceInstance, field: 'predictedDate', 'error')} ">
	<label for="predictedDate">
		<g:message code="maintenance.predictedDate.label" default="Predicted Date" />
		
	</label>
	<g:field id="datepicker" name="predictedDate" type="text" readonly="true" value="${maintenanceInstance?.predictedDate?.format("yyyy/MM/dd")}"  />
</div>

<div class="fieldcontain ${hasErrors(bean: maintenanceInstance, field: 'date', 'error')} required">
	<label for="date">
		<g:message code="maintenance.date.label" default="Date" />
		<span class="required-indicator">*</span>	
	</label>
	<g:field id="datepicker2" name="date" type="text" readonly="true" value="${maintenanceInstance?.date?.format("yyyy/MM/dd")}" required="" />
</div>

<div class="fieldcontain ${hasErrors(bean: maintenanceInstance, field: 'cost', 'error')} required">
	<label for="cost">
		<g:message code="maintenance.cost.label" default="Cost" />
		<span class="required-indicator">*</span>
	</label>
	<g:field name="cost" type="number decimal" value="${fieldValue(bean: maintenanceInstance, field: 'cost')}" required="" pattern="\\d+(\\.\\d{2})?"/>
</div>

<div class="fieldcontain ${hasErrors(bean: maintenanceInstance, field: 'mileage', 'error')} required">
	<label for="mileage">
		<g:message code="maintenance.mileage.label" default="Mileage" />
		<span class="required-indicator">*</span>
	</label>
	<g:field name="mileage" type="number decimal" value="${maintenanceInstance.mileage}" required="" pattern="\\d+(\\.\\d{2})?"/>
</div>

<div class="fieldcontain ${hasErrors(bean: maintenanceInstance, field: 'description', 'error')} ">
	<label for="description">
		<g:message code="maintenance.description.label" default="Description" />
		
	</label>
	<g:textArea name="description" cols="40" rows="5" value="${maintenanceInstance?.description}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: maintenanceInstance, field: 'vehicle', 'error')} required">
	<label for="vehicle">
		<g:message code="maintenance.vehicle.label" default="Vehicle" />
	</label>
	<g:field name="vehicle" type="hidden" readonly="true" value="${maintenanceInstance.vehicle.id} "/>
	<label for="vehicle">${maintenanceInstance.vehicle.registerNumber}</label>
</div>

